package com.shop2cn.iapi.sqoptrade.testcase;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.ymttest.business.service.shenqi.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.cdfgeteway.resp.PointsVo;
import com.shop2cn.iapi.shenqisettlement.parameter.bean.AgentProductBean;
import com.shop2cn.iapi.sqoptrade.parameter.enums.CouponApplianceTypeEnum;
import com.shop2cn.iapi.sqoptrade.parameter.enums.CouponMainTypeEnum;
import com.shop2cn.iapi.sqoptrade.parameter.enums.CouponTypeEnum;
import com.shop2cn.iapi.sqoptrade.parameter.enums.PromotionTypeEnum;
import com.shop2cn.iapi.sqoptrade.parameter.req.PlaceOrderReq;
import com.shop2cn.iapi.sqoptrade.parameter.vo.ActivityVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.CatalogApportionVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.CouponVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.OrderItemVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.OrderVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.SellerPromotionVo;
import com.shop2cn.iapi.sqoptrade.service.PlaceOrderCall;
import com.shop2cn.iapi.sqoptrade.verify.DGSQPlaceOrderVerifyService;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.AccountCallServiceV2;
import com.ymttest.business.service.GodmchManageCallService;
import com.ymttest.business.service.shenqi.bean.ShenqiUserSet;
import com.ymttest.database.sharding.db.sqlwapper.OrderShardingWapper;

@Ignore
public class Ts_DGSQCDFPlaceOrder {

	private static PlaceOrderReq placeOrderReq;
	private static PlaceOrderCall placeorderCall;

	private static OrderShardingWapper orderShardingWapper = new OrderShardingWapper();

	private static long cdfMembergoodsOwnerId = ShenqiUserSet.cdfMembergoodsOwnerId;
	private static long multiCDFCodeGoodsOwnerId = ShenqiUserSet.multiCDFCodeGoodsOwnerId;
	private static long macaoCDFGoodsOwnerId = ShenqiUserSet.macaoCDFGoodsOwnerId;
	private static long shenqiRiskControlGoodsOwnerId = ShenqiUserSet.shenqiRiskControlGoodsOwnerId;

	String key = "1234567890123456";

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("中免大会员，创建订单(新)接口，积分、一品多码、优惠券");

		String accountid1;
		try {
			accountid1 = AccountCallServiceV2.getAccountId(20238699);
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(
					9000000), new BigDecimal(0));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Before
	public void caseUp() {
		placeOrderReq = new PlaceOrderReq();
		placeorderCall = new PlaceOrderCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(placeorderCall.getOpurl());
		orderShardingWapper.activeDeadCommunicationsLink(orderShardingWapper);
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	public void verify() throws Exception {

		DGSQPlaceOrderVerifyService sqPlaceOrderVerifyService = new DGSQPlaceOrderVerifyService(
				placeOrderReq, placeorderCall);

		sqPlaceOrderVerifyService.verify();
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void PRD_BUG_TEST() {
		Logger.start(true, "中免大会员，使用积分，多个订单多个商品");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean1, (int) cdfMembergoodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C052901");
			orderItemVo1.setProductRecordNo("C052901");
			orderItemVo1.setProductNum(1);
			orderItemVo1.setProductPrice(new BigDecimal("517.88"));
			orderItemVo1.setFreight(BigDecimal.ZERO);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean1.getProductId(),
							productBean1.getCatalogList().get(1));

			orderItemVo2.setSku("C052902");
			orderItemVo2.setProductRecordNo("C052902");
			orderItemVo2.setProductNum(1);
			orderItemVo2.setProductPrice(new BigDecimal("195.54"));
			orderItemVo2.setFreight(BigDecimal.ZERO);

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			OrderItemVo orderItemVo3 = SqTradingCallService
					.createOrderItemVo(productBean2.getProductId(),
							productBean2.getCatalogList().get(0));

			orderItemVo3.setSku("C052899");
			orderItemVo3.setProductRecordNo("C052899");
			orderItemVo3.setProductNum(1);
			orderItemVo3.setProductPrice(new BigDecimal("195.54"));
			orderItemVo3.setFreight(BigDecimal.ZERO);

			OrderItemVo orderItemVo4 = SqTradingCallService
					.createOrderItemVo(productBean2.getProductId(),
							productBean2.getCatalogList().get(1));

			orderItemVo4.setSku("C052900");
			orderItemVo4.setProductRecordNo("C052900");
			orderItemVo4.setProductNum(2);
			orderItemVo4.setProductPrice(new BigDecimal("61.52"));
			orderItemVo4.setFreight(BigDecimal.ZERO);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo3);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo4);

			placeOrderReq.setIntegral(1029L);
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			// 获取下单后中免大会员可用积分和冻结积分
			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void PRD_BUG_TEST1() {
		Logger.start(true, "中免大会员，使用积分，一个订单多个商品，其中一个商品非积分使用商品");
		try {
			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) cdfMembergoodsOwnerId, false, true);

			// AgentProductBean productBean1 = DGSQBuildProxyChainCallService
			// .createProxychain((int) cdfMembergoodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.ZERO, 26080783, productBean1,
					productBean1.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSubProduct(true);
			orderItemVo1.setSku("C052901");
			orderItemVo1.setProductRecordNo("C052901");
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setProductPrice(new BigDecimal("620.00"));
			orderItemVo1.setOriginalPrice(new BigDecimal("620.00"));
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) cdfMembergoodsOwnerId, false, true);

			OrderItemVo orderItemVo2 = SqTradingCallService.createOrderItemVo(
					productBean2.getRootProductId(), productBean2
							.getCatalogList().get(0));

			orderItemVo2.setSubProduct(true);
			orderItemVo2.setSku("C052900");
			orderItemVo2.setProductRecordNo("C052900");
			orderItemVo2.setFreight(BigDecimal.ZERO);
			orderItemVo2.setProductPrice(new BigDecimal("620.00"));
			orderItemVo2.setOriginalPrice(new BigDecimal("620.00"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);
			
			AgentProductBean productBean3 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			OrderItemVo orderItemVo3 = SqTradingCallService.createOrderItemVo(
					productBean3.getRootProductId(), productBean3
							.getCatalogList().get(0));

			orderItemVo3.setSku("C052900");
			orderItemVo3.setProductRecordNo("C052900");
			orderItemVo3.setFreight(BigDecimal.ZERO);
			orderItemVo3.setProductPrice(new BigDecimal("620.00"));
			orderItemVo3.setOriginalPrice(new BigDecimal("620.00"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo3);

			OrderItemVo orderItemVo4 = SqTradingCallService.createOrderItemVo(
					productBean3.getRootProductId(), productBean3
							.getCatalogList().get(1));

			orderItemVo4.setSku("C052901");
			orderItemVo4.setProductRecordNo("C052901");
			orderItemVo4.setFreight(BigDecimal.ZERO);
			orderItemVo4.setProductPrice(new BigDecimal("620.00"));
			orderItemVo4.setOriginalPrice(new BigDecimal("620.00"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo4);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(orderItemVo1.getCatalogId(),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			 placeOrderReq.setIntegral(100L);
			 placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_140() {
		Logger.start(true, "中免大会员，使用积分，一个订单一个商品");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			// 直播点击上报
			SqUserClickService.userClick(26080783L, productBean.getSellerId(),
					productBean.getProductId());

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId, true);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setSku("C052901");
			orderItemVo.setProductRecordNo("C052901");
			
			placeOrderReq.setIntegral(1L);
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			// 获取下单后中免大会员可用积分和冻结积分
			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_141() {
		Logger.start(true, "中免大会员，使用1积分，一个订单多个商品");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C052901");
			orderItemVo1.setProductRecordNo("C052901");
			orderItemVo1.setProductPrice(new BigDecimal("200.00"));
			orderItemVo1.setProductNum(2);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setSku("C052902");
			orderItemVo2.setProductRecordNo("C052902");
			orderItemVo2.setProductPrice(new BigDecimal("100.00"));
			orderItemVo2.setProductNum(3);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setIntegral(1L);
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			// 获取下单后中免大会员可用积分和冻结积分
			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_142() {
		Logger.start(true, "中免大会员，使用100积分，多个订单多个商品");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean1, (int) cdfMembergoodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C052901");
			orderItemVo1.setProductRecordNo("C052901");
			orderItemVo1.setFreight(BigDecimal.ZERO);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean1.getProductId(),
							productBean1.getCatalogList().get(1));

			orderItemVo2.setSku("C052902");
			orderItemVo2.setProductRecordNo("C052902");
			orderItemVo2.setFreight(BigDecimal.ZERO);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			AgentProductBean productBean3 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean2, productBean3));

			OrderItemVo orderItemVo3 = orderVo.getOrderItems().get(0);

			orderItemVo3.setSku("C052899");
			orderItemVo3.setProductRecordNo("C052899");

			OrderItemVo orderItemVo4 = orderVo.getOrderItems().get(0);

			orderItemVo4.setSku("C052900");
			orderItemVo4.setProductRecordNo("C052900");

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			
			placeOrderReq.setIntegral(100L);
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			// 获取下单后中免大会员可用积分和冻结积分
			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_143() {
		Logger.start(true, "中免大会员，一次下单多个组合商品，带有各种优惠、折扣和税费，使用积分，生产一个订单");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) cdfMembergoodsOwnerId, false, true);
			
//			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
//					.createProxychain((int) cdfMembergoodsOwnerId, 0, false);	

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 26080783,
							productBean1, productBean1.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSubProduct(true);
			orderItemVo1.setSku("C052901");
			orderItemVo1.setProductRecordNo("C052901");
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setProductPrice(new BigDecimal("620.00"));
			orderItemVo1.setOriginalPrice(new BigDecimal("620.00"));
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) cdfMembergoodsOwnerId, false, true);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean2.getRootProductId(),
							productBean2.getCatalogList().get(0));

			orderItemVo2.setSubProduct(true);
			orderItemVo2.setSku("C052900");
			orderItemVo2.setProductRecordNo("C052900");
			orderItemVo2.setFreight(BigDecimal.ZERO);
			orderItemVo2.setProductPrice(new BigDecimal("620.00"));
			orderItemVo2.setOriginalPrice(new BigDecimal("620.00"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(orderItemVo1.getCatalogId(),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeOrderReq.setIntegral(100L);
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_144() {
		Logger.start(true, "中免大会员，使用积分，一个订单多个商品，其中一个商品非积分使用商品");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C052901");
			orderItemVo1.setProductRecordNo("C052901");
			orderItemVo1.setProductPrice(BigDecimal.ONE);
			orderItemVo1.setProductNum(2);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setProdTaxRate(BigDecimal.ZERO);

			Long integral = 2L;

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setSku(null);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean1));

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_145() {
		Logger.start(true, "中免大会员，使用积分，一个订单多个商品，其中一个商品非积分使用商品，超过最大可使用积分");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C052901");
			orderItemVo1.setProductRecordNo("C052901");
			orderItemVo1.setProductPrice(BigDecimal.ONE);
			orderItemVo1.setProductNum(2);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setProdTaxRate(BigDecimal.ZERO);

			Long integral = 3L;

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(121, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true, placeorderCall.getMsg()
					.contains("积分余额不足"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_146() {
		Logger.start(true, "中免大会员，使用积分，一个订单多个商品，其中一个商品非积分使用商品");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C052901");
			orderItemVo1.setProductRecordNo("C052901");
			orderItemVo1.setProductPrice(BigDecimal.ONE);
			orderItemVo1.setProductNum(2);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setProdTaxRate(BigDecimal.ZERO);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setSku("C052901");
			orderItemVo2.setProductRecordNo("C052901");
			orderItemVo2.setProductPrice(BigDecimal.ONE);
			orderItemVo2.setProductNum(1);
			orderItemVo2.setFreight(BigDecimal.ZERO);
			orderItemVo2.setProdTaxRate(BigDecimal.ZERO);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean1));

			OrderItemVo orderItemVo3 = orderVo.getOrderItems().get(0);

			orderItemVo3.setSku("C052901");
			orderItemVo3.setProductRecordNo("C052901");
			orderItemVo3.setProductPrice(BigDecimal.ONE);
			orderItemVo3.setProductNum(2);
			orderItemVo3.setFreight(BigDecimal.ZERO);
			orderItemVo3.setProdTaxRate(BigDecimal.ZERO);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			Long integral = 3L;
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_147() {
		Logger.start(true, "中免大会员，主商品带换购商品，使用积分，下单成功");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, productBean.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			ActivityVo activityVo = new ActivityVo();

			activityVo.setActivityId(activityId);
			activityVo.setActivityTemplateId(5123);
			activityVo.setAfterActivityFinishAccept(true);
			activityVo.setProductInActivityId(1234);

			orderItemVo1.setActivity(activityVo);
			orderItemVo1.setExchangeBuyActivityId(activityId);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProductNum(1);
			orderItemVo2.setExchangeBuy(true);

			orderItemVo2.setActivity(activityVo);
			orderItemVo2.setExchangeBuyActivityId(activityId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setDiscount(BigDecimal.TEN);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_150() {
		Logger.start(true, "中免大会员，使用积分，多个订单多个商品");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean1, (int) cdfMembergoodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C052901");
			orderItemVo1.setProductRecordNo("C052901");
			orderItemVo1.setProductNum(1);
			orderItemVo1.setProductPrice(new BigDecimal("1.50"));
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setDomesticProduct(true);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean1.getProductId(),
							productBean1.getCatalogList().get(1));

			orderItemVo2.setSku("C052902");
			orderItemVo2.setProductRecordNo("C052902");
			orderItemVo2.setProductNum(1);
			orderItemVo2.setProductPrice(new BigDecimal("1.50"));
			orderItemVo2.setFreight(BigDecimal.ZERO);
			orderItemVo2.setDomesticProduct(true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId, false);

			AgentProductBean productBean3 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId, false);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean2, productBean3));

			OrderItemVo orderItemVo3 = orderVo.getOrderItems().get(0);

			orderItemVo3.setSku("C052899");
			orderItemVo3.setProductRecordNo("C052899");
			orderItemVo3.setProductNum(1);
			orderItemVo3.setProductPrice(new BigDecimal("1.50"));
			orderItemVo3.setFreight(BigDecimal.ZERO);
			orderItemVo3.setDomesticProduct(true);

			OrderItemVo orderItemVo4 = orderVo.getOrderItems().get(1);

			orderItemVo4.setSku("C052900");
			orderItemVo4.setProductRecordNo("C052900");
			orderItemVo4.setProductNum(1);
			orderItemVo4.setProductPrice(new BigDecimal("1.50"));
			orderItemVo4.setFreight(BigDecimal.ZERO);
			orderItemVo4.setDomesticProduct(true);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeOrderReq.setIntegral(2L);
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			// 获取下单后中免大会员可用积分和冻结积分
			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_151() {
		Logger.start(true, "一品多码商品下单");
		try {

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) multiCDFCodeGoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean1,
							(int) multiCDFCodeGoodsOwnerId);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_152() {
		Logger.start(true, "直销商下单一品多码组合商品，一次下单一个商品,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) multiCDFCodeGoodsOwnerId, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean,
							(int) multiCDFCodeGoodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setSubProduct(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_153() {
		Logger.start(true, "一品多码商品，多规格多子码，下单");
		try {

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) multiCDFCodeGoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean1,
							(int) multiCDFCodeGoodsOwnerId);

			OrderItemVo orderItemVo = SqTradingCallService
					.createOrderItemVo(productBean1.getProductId(),
							productBean1.getCatalogList().get(1));

			orderItemVo.setProductNum(2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_154() {
		Logger.start(true, "一品多码商品，超过子码总数量，下单失败");
		try {

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) multiCDFCodeGoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean1,
							(int) multiCDFCodeGoodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductNum(11);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(108, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("商品库存不足|商品库存不足"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_155() {
		Logger.start(true, "渠道商一次下单一个自动接单一品多码活动商品,生产一个订单");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) multiCDFCodeGoodsOwnerId,
							false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean,
							(int) multiCDFCodeGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			ActivityVo activityVo = new ActivityVo();

			activityVo.setActivityId(activityId);
			activityVo.setActivityTemplateId(5123);
			activityVo.setAfterActivityFinishAccept(true);
			activityVo.setProductInActivityId(1234);

			orderItemVo.setActivity(activityVo);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_156() {
		Logger.start(true, "渠道商一次下单一个自动接单一品多码活动商品,购买数量超过活动商品数量，下单失败");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) multiCDFCodeGoodsOwnerId,
							false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean,
							(int) multiCDFCodeGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			ActivityVo activityVo = new ActivityVo();

			activityVo.setActivityId(activityId);
			activityVo.setActivityTemplateId(5123);
			activityVo.setAfterActivityFinishAccept(true);
			activityVo.setProductInActivityId(1234);

			orderItemVo.setActivity(activityVo);
			orderItemVo.setProductNum(6);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(108, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("商品子码库存不足|商品规格子码活动库存不足"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_157() {
		Logger.start(true, "代购神器直销商，主商品带换购商品，一品多码商品，下单成功");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) multiCDFCodeGoodsOwnerId,
							false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, productBean.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			ActivityVo activityVo = new ActivityVo();

			activityVo.setActivityId(activityId);
			activityVo.setActivityTemplateId(5123);
			activityVo.setAfterActivityFinishAccept(true);
			activityVo.setProductInActivityId(1234);

			orderItemVo1.setActivity(activityVo);
			orderItemVo1.setExchangeBuyActivityId(activityId);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProductNum(1);
			orderItemVo2.setExchangeBuy(true);

			orderItemVo2.setActivity(activityVo);
			orderItemVo2.setExchangeBuyActivityId(activityId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_168() {
		Logger.start(true, "中免大会员，带区域折扣，优惠券模式为大会员+满减，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							true);
			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

//			orderItemVo1.setProductPrice(new BigDecimal("200.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setFullReductionFreeFreight(true);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.15"));
			orderItemVo1.setSku("C042283");
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("9.00"));

			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(
					CouponTypeEnum.FULL_REDUCTION_COUPON.getCode(), 1,
					26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.FULL_REDUCTION_COUPON
					.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));

			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_169() {
		Logger.start(true, "中免大会员，多个商品一个订单，带满减优惠，优惠券模式为大会员+满折，下单成功");
		try {
			
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							true);
			
			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProductPrice(new BigDecimal("2000.00"));
			orderItemVo2.setProductNum(2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0).setAutoCancelOrderHours(new BigDecimal("0.5"));
			
			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(CouponTypeEnum.FULL_DISCOUNT_COUPON
					.getCode(), 1, 26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.FULL_DISCOUNT_COUPON
					.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(4900));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);
			
			placeOrderReq.getOrderGroups().get(0)
					.setServiceRate(new BigDecimal("10.00"));
			
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_170() {
		Logger.start(true, "中免大会员，多个商品多个订单，带区域折扣，优惠券模式为大会员+现金券，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setSku("C042283");
			orderItemVo1.setDomesticProduct(true);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProductPrice(new BigDecimal("2000.00"));
			orderItemVo2.setProductNum(2);
			orderItemVo2.setSku("C042283");
			orderItemVo2.setDomesticProduct(true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("9.00"));

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			placeOrderReq
					.getOrderGroups()
					.get(0)
					.getOrders()
					.add(SqTradingCallService.createOrderVo(Arrays
							.asList(productBean1)));
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(1)
					.getOrderItems().get(0).setSku("C042283");

			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(CouponTypeEnum.CASH_COUPON
					.getCode(), 1, 26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.CASH_COUPON
					.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));
//			couponVo.setCouponCode("2021082458185915446");
			
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_171() {
		Logger.start(true, "中免大会员，优惠券模式为大会员+代金券+积分，下单成功");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId, true);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProductPrice(new BigDecimal("50.00"));
			orderItemVo.setProductNum(1);
			orderItemVo.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo.setFullReductionFreeFreight(true);
			orderItemVo.setProdTaxRate(new BigDecimal("0.15"));
			orderItemVo.setSku("C052901");
			orderItemVo.setProductRecordNo("C052901");
			orderItemVo.setDomesticProduct(true);
			
			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(CouponTypeEnum.CASH_COUPON
					.getCode(), 1, 26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.CASH_COUPON
					.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));
			
			placeOrderReq.setIntegral(19L);
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			// 获取下单后中免大会员可用积分和冻结积分
			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_172() {
		Logger.start(true, "中免大会员，多个商品一个订单，优惠券模式为大会员+代金券，订单金额小于代金券，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setSku("C042283");

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProductPrice(new BigDecimal("10.00"));
			orderItemVo2.setProductNum(1);
			orderItemVo2.setFreight(BigDecimal.ZERO);
			orderItemVo2.setSku("C042283");

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);
			
			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(CouponTypeEnum.CASH_COUPON
					.getCode(), 1, 26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.CASH_COUPON
					.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));
			
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_173() {
		Logger.start(true, "中免大会员，代购神器直销商，主商品带换购商品，优惠券模式为大会员+代金券，下单成功");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 26080783,
							productBean, productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductNum(1);

			ActivityVo activityVo = new ActivityVo();

			activityVo.setActivityId(activityId);
			activityVo.setActivityTemplateId(5123);
			activityVo.setAfterActivityFinishAccept(true);
			activityVo.setProductInActivityId(1234);

			orderItemVo1.setActivity(activityVo);
			orderItemVo1.setExchangeBuyActivityId(activityId);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProductNum(1);
			orderItemVo2.setExchangeBuy(true);
			orderItemVo2.setProductPrice(new BigDecimal("0.01"));

			orderItemVo2.setActivity(activityVo);
			orderItemVo2.setExchangeBuyActivityId(activityId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("9.50"));
			
			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(CouponTypeEnum.CASH_COUPON.getCode(), 1, 26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.CASH_COUPON.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));
			
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_174() {
		Logger.start(true, "中免大会员，多个商品一个订单，总金额等于1元，使用大会员代金券，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setSku("C042283");
			orderItemVo1.setProductRecordNo("C042283");

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProductPrice(new BigDecimal("2000.00"));
			orderItemVo2.setProductNum(2);
			orderItemVo2.setSku("C042283");
			orderItemVo2.setProductRecordNo("C042283");

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);
			
			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(CouponTypeEnum.CASH_COUPON
					.getCode(), 1, 26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.CASH_COUPON
					.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal("4999.00"));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);
			
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_175() {
		Logger.start(true, "中免大会员，多个商品一个订单，总金额等于1.01元，使用大会员代金券，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProductPrice(new BigDecimal("2000.00"));
			orderItemVo2.setProductNum(2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);
			
			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(CouponTypeEnum.CASH_COUPON.getCode(),
					1, 26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.CASH_COUPON
					.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal("4998.99"));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);
			
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_176() {
		Logger.start(true, "直销商下单组合商品，带有区域折扣，使用大会员代金券,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) cdfMembergoodsOwnerId, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ONE.negate(),
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0)
					.setProductPrice(new BigDecimal("30.00"));
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductNum(1);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setFullReductionFreeFreight(true);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setSku("C042283");
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setDomesticProduct(true);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setSubProduct(true);

			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(CouponTypeEnum.CASH_COUPON.getCode(), 1, 26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.CASH_COUPON.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("2.00"));
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_177() {
		Logger.start(true, "直销商下单组合商品，子商品不满足满减条件，使用大会员满减券,下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) cdfMembergoodsOwnerId, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ONE.negate(),
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductPrice(new BigDecimal("30.00"));
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductNum(1);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setFullReductionFreeFreight(true);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setSubProduct(true);

			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(
					CouponTypeEnum.FULL_REDUCTION_COUPON.getCode(), 1,
					26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.FULL_REDUCTION_COUPON.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(true, placeorderCall.getMsg()
					.contains("扣优惠券失败"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_178() {
		Logger.start(true, "直销商下单组合商品，子商品不满足满减条件，使用大会员满减券,下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) cdfMembergoodsOwnerId, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ONE.negate(),
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductPrice(new BigDecimal("30.00"));
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductNum(1);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setFullReductionFreeFreight(true);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setSubProduct(true);
			
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);
			
			OrderItemVo orderItemVo = SqTradingCallService.createOrderItemVo(productBean1
					.getProductId(), productBean1.getCatalogList().get(0));
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0).getOrderItems().add(orderItemVo);

			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(
					CouponTypeEnum.FULL_REDUCTION_COUPON.getCode(), 1,
					26080783L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.FULL_REDUCTION_COUPON.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					26080783L, cdfMembergoodsOwnerId));
			
			placeOrderReq.setIntegralServiceType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(true, placeorderCall.getMsg()
					.contains("扣优惠券失败"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_182() {
		Logger.start(true, "一品多码商品下单，一个主单两个订单，使用同一个商品");
		try {

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) multiCDFCodeGoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean1,
							(int) multiCDFCodeGoodsOwnerId);
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductNum(1);
			
			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean1));
			
			orderVo.getOrderItems().get(0).setProductNum(2);
			
			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_183() {
		Logger.start(true, "直销商下单一品多码组合商品,使用兑换券，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) multiCDFCodeGoodsOwnerId, false, true);
			
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.ZERO, 20238699, productBean,
					productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(3);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setSubProduct(true);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_184() {
		Logger.start(true, "中免大会员，使用100积分，使用兑换券，多个订单多个商品");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.ZERO, 26080783, productBean1,
					productBean1.getSellerId(), true);
			
			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C052901");
			orderItemVo1.setProductRecordNo("C052901");
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setDomesticProduct(true);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean1.getProductId(),
							productBean1.getCatalogList().get(1));

			orderItemVo2.setSku("C052902");
			orderItemVo2.setProductRecordNo("C052902");
			orderItemVo2.setFreight(BigDecimal.ZERO);
			orderItemVo2.setDomesticProduct(true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			AgentProductBean productBean3 = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean2, productBean3));

			OrderItemVo orderItemVo3 = orderVo.getOrderItems().get(0);

			orderItemVo3.setSku("C052899");
			orderItemVo3.setProductRecordNo("C052899");
			orderItemVo3.setDomesticProduct(true);

			OrderItemVo orderItemVo4 = orderVo.getOrderItems().get(1);

			orderItemVo4.setSku("C052900");
			orderItemVo4.setProductRecordNo("C052900");
			orderItemVo4.setDomesticProduct(true);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			
			placeOrderReq.setIntegral(100L);
			placeOrderReq.setIntegralServiceType(2);
			
			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			// 获取下单后中免大会员可用积分和冻结积分
			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					cdfMembergoodsOwnerId, 26080783L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_185() {
		Logger.start(true, "中免澳门大会员，使用积分，一个订单一个商品");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					macaoCDFGoodsOwnerId, 502603484L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();
			Long integral = 1L;

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							502603484L, productBean, (int) macaoCDFGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setSku("C040644");
			orderItemVo.setProductRecordNo("C040644");
			
			placeOrderReq.setCurrency("MOP");
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);
			
			BigDecimal exchangeRate = GodmchManageCallService.getEffectExchangeRate(502665591L);
			
			placeOrderReq.setIntegralDeductAmount(new BigDecimal(integral)
					.multiply(exchangeRate).setScale(2,
							BigDecimal.ROUND_HALF_DOWN));
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setCrossBorderType(3);
			placeOrderReq.setIntegralExchangeRate(exchangeRate);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			// 获取下单后中免大会员可用积分和冻结积分
			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					macaoCDFGoodsOwnerId, 502603484L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_186() {
		Logger.start(true, "中免澳门大会员，使用积分，金额不匹配");
		try {

//			// 获取下单前中免大会员可用积分和冻结积分
//			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
//					macaoCDFGoodsOwnerId, 502603484L);

			Long integral = 1L;

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							502603484L, productBean, (int) macaoCDFGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setSku("C040644");
			orderItemVo.setProductRecordNo("C040644");
			
			placeOrderReq.setCurrency("MOP");
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);
			
			placeOrderReq.setIntegralDeductAmount(BigDecimal.TEN);
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setCrossBorderType(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("积分汇率已变更，请重新下单"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_187() {
		Logger.start(true, "中免澳门大会员，使用积分，0元支付");
		try {
		
			Long integral = 1L;

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							502603484L, productBean, (int) macaoCDFGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setSku("C040644");
			orderItemVo.setProductRecordNo("C040644");
			orderItemVo.setFullReductionFreeFreight(true);
			orderItemVo.setProductNum(1);
			orderItemVo.setProductPrice(new BigDecimal("1.25"));
			
			placeOrderReq.setCurrency("MOP");
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);
			
			BigDecimal exchangeRate = GodmchManageCallService
					.getEffectExchangeRate(macaoCDFGoodsOwnerId);

			placeOrderReq.setIntegralDeductAmount(new BigDecimal(integral)
					.multiply(exchangeRate).setScale(2,
							BigDecimal.ROUND_HALF_DOWN));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setCrossBorderType(3);
			placeOrderReq.setIntegralExchangeRate(exchangeRate);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_188() {
		Logger.start(true, "中免澳门大会员，使用1积分，一个订单多个商品");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					macaoCDFGoodsOwnerId, 502603484L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();
			Long integral = 1L;

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							502603484L, productBean, (int) macaoCDFGoodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C040644");
			orderItemVo1.setProductRecordNo("C040644");
			orderItemVo1.setProductPrice(new BigDecimal("200.00"));
			orderItemVo1.setProductNum(2);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setSku("C040651");
			orderItemVo2.setProductRecordNo("C040651");
			orderItemVo2.setProductPrice(new BigDecimal("100.00"));
			orderItemVo2.setProductNum(3);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setCurrency("MOP");
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);
			
			BigDecimal exchangeRate = GodmchManageCallService
					.getEffectExchangeRate(502665591L);

			placeOrderReq.setIntegralDeductAmount(new BigDecimal(integral)
					.multiply(exchangeRate).setScale(2,
							BigDecimal.ROUND_HALF_DOWN));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setCrossBorderType(3);
			placeOrderReq.setIntegralExchangeRate(exchangeRate);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			// 获取下单后中免大会员可用积分和冻结积分
			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					macaoCDFGoodsOwnerId, 502603484L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_189() {
		Logger.start(true, "中免澳门大会员，使用100积分，多个订单多个商品");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					macaoCDFGoodsOwnerId, 502603484L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();
			Long integral = 100L;

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							502603484L, productBean1, (int) macaoCDFGoodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C040661");
			orderItemVo1.setProductRecordNo("C040661");
			orderItemVo1.setFreight(BigDecimal.ZERO);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean1.getProductId(),
							productBean1.getCatalogList().get(1));

			orderItemVo2.setSku("C040620");
			orderItemVo2.setProductRecordNo("C040620");
			orderItemVo2.setFreight(BigDecimal.ZERO);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			AgentProductBean productBean3 = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean2, productBean3));

			OrderItemVo orderItemVo3 = orderVo.getOrderItems().get(0);

			orderItemVo3.setSku("C040623");
			orderItemVo3.setProductRecordNo("C040623");

			OrderItemVo orderItemVo4 = orderVo.getOrderItems().get(0);

			orderItemVo4.setSku("C040626");
			orderItemVo4.setProductRecordNo("C040626");

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			
			placeOrderReq.setCurrency("MOP");
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);
			
			BigDecimal exchangeRate = GodmchManageCallService
					.getEffectExchangeRate(macaoCDFGoodsOwnerId);

			placeOrderReq.setIntegralDeductAmount(new BigDecimal(integral)
					.multiply(exchangeRate).setScale(2,
							BigDecimal.ROUND_HALF_DOWN));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setCrossBorderType(3);
			placeOrderReq.setIntegralExchangeRate(exchangeRate);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			// 获取下单后中免大会员可用积分和冻结积分
			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					macaoCDFGoodsOwnerId, 502603484L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_190() {
		Logger.start(true, "中免澳门大会员，一次下单多个组合商品，带有各种优惠、折扣和税费，使用积分，生产一个订单");
		try {

			// 获取下单前中免大会员可用积分和冻结积分
			PointsVo pointsVo = CDFMemberService.getCDFMemberUserPoints(
					macaoCDFGoodsOwnerId, 502603484L);

			Long balance = pointsVo.getBalance();
			Long frozenBalance = pointsVo.getFrozenBalance();
			Long integral = 50L;

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) macaoCDFGoodsOwnerId, true, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 502603484L,
							productBean1, productBean1.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSubProduct(true);
			orderItemVo1.setSku("C040648");
			orderItemVo1.setProductRecordNo("C040648");
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setProductPrice(new BigDecimal("620.00"));
			orderItemVo1.setOriginalPrice(new BigDecimal("620.00"));
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) macaoCDFGoodsOwnerId, true, false);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean2.getRootProductId(),
							productBean2.getCatalogList().get(0));

			orderItemVo2.setSubProduct(true);
			orderItemVo2.setSku("C040656");
			orderItemVo2.setProductRecordNo("C040656");
			orderItemVo2.setFreight(BigDecimal.ZERO);
			orderItemVo2.setProductPrice(new BigDecimal("620.00"));
			orderItemVo2.setOriginalPrice(new BigDecimal("620.00"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(orderItemVo1.getCatalogId(),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeOrderReq.setCurrency("MOP");
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);
			
			BigDecimal exchangeRate = GodmchManageCallService
					.getEffectExchangeRate(macaoCDFGoodsOwnerId);

			placeOrderReq.setIntegralDeductAmount(new BigDecimal(integral)
					.multiply(exchangeRate).setScale(2,
							BigDecimal.ROUND_HALF_DOWN));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setCrossBorderType(3);
			placeOrderReq.setIntegralExchangeRate(exchangeRate);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

			PointsVo afterPointsVo = CDFMemberService.getCDFMemberUserPoints(
					macaoCDFGoodsOwnerId, 502603484L);

			Logger.verifyEquals(balance - placeOrderReq.getIntegral(),
					afterPointsVo.getBalance(), "验证下单后的balance");
			Logger.verifyEquals(frozenBalance + placeOrderReq.getIntegral(),
					afterPointsVo.getFrozenBalance(), "验证下单后的frozenBalance");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_191() {
		Logger.start(true, "中免澳门大会员，使用积分，一个订单多个商品，其中一个商品非积分使用商品");
		try {

			Long integral = 2L;
			
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							502603484L, productBean, (int) macaoCDFGoodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C040623");
			orderItemVo1.setProductRecordNo("C040623");
			orderItemVo1.setProductPrice(BigDecimal.ONE);
			orderItemVo1.setProductNum(5);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setProdTaxRate(BigDecimal.ZERO);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setSku(null);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean1));

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			
			placeOrderReq.setCurrency("MOP");
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);
			
			BigDecimal exchangeRate = GodmchManageCallService
					.getEffectExchangeRate(macaoCDFGoodsOwnerId);

			placeOrderReq.setIntegralDeductAmount(new BigDecimal(integral)
					.multiply(exchangeRate).setScale(2,
							BigDecimal.ROUND_HALF_DOWN));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setCrossBorderType(3);
			placeOrderReq.setIntegralExchangeRate(exchangeRate);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_192() {
		Logger.start(true, "中免澳门大会员，使用100积分，使用兑换券，多个订单多个商品");
		try {

			Long integral = 2L;
			
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							502603484L, productBean1, (int) macaoCDFGoodsOwnerId, true);
			
			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSku("C040645");
			orderItemVo1.setProductRecordNo("C040645");
			orderItemVo1.setFreight(BigDecimal.ZERO);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean1.getProductId(),
							productBean1.getCatalogList().get(1));

			orderItemVo2.setSku("C040646");
			orderItemVo2.setProductRecordNo("C040646");
			orderItemVo2.setFreight(BigDecimal.ZERO);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			AgentProductBean productBean3 = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean2, productBean3));

			OrderItemVo orderItemVo3 = orderVo.getOrderItems().get(0);

			orderItemVo3.setSku("C040648");
			orderItemVo3.setProductRecordNo("C040648");

			OrderItemVo orderItemVo4 = orderVo.getOrderItems().get(1);

			orderItemVo4.setSku("C040664");
			orderItemVo4.setProductRecordNo("C040664");

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			
			placeOrderReq.setCurrency("MOP");
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);
			
			BigDecimal exchangeRate = GodmchManageCallService
					.getEffectExchangeRate(macaoCDFGoodsOwnerId);

			placeOrderReq.setIntegralDeductAmount(new BigDecimal(integral)
					.multiply(exchangeRate).setScale(2,
							BigDecimal.ROUND_HALF_DOWN));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setCrossBorderType(3);
			placeOrderReq.setIntegralExchangeRate(exchangeRate);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_193() {
		Logger.start(true, "中免澳门大会员，优惠券模式为大会员+代金券+积分，下单成功");
		try {

			Long integral = 2L;

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false,
							true);

			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(
					4321, BigDecimal.ZERO, 502603484L, productBean1,
					(int) macaoCDFGoodsOwnerId, true);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProductPrice(new BigDecimal("50.00"));
			orderItemVo.setProductNum(1);
			orderItemVo.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo.setFreight(BigDecimal.TEN);
			orderItemVo.setProdTaxRate(new BigDecimal("0.15"));
			orderItemVo.setSku("C040645");
			orderItemVo.setProductRecordNo("C040645");
			
			// 领取cdf优惠券
			CDFMemberService.getCdfCoupon(CouponTypeEnum.CASH_COUPON
					.getCode(), 2, 502603484L);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(1);
			couponVo.setCouponType(CouponTypeEnum.CASH_COUPON
					.getCode());
			couponVo.setCouponCode(CDFMemberService.getLatestUnuseCdfCoupon(
					502603484L, macaoCDFGoodsOwnerId));
			
			placeOrderReq.setCurrency("MOP");
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);
			
			BigDecimal exchangeRate = GodmchManageCallService
					.getEffectExchangeRate(macaoCDFGoodsOwnerId);

			placeOrderReq.setIntegralDeductAmount(new BigDecimal(integral)
					.multiply(exchangeRate).setScale(2,
							BigDecimal.ROUND_HALF_DOWN));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setCrossBorderType(3);
			placeOrderReq.setIntegralExchangeRate(exchangeRate);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_194() {
		Logger.start(true, "中免澳门大会员，使用积分超过商品可支付金额，下单失败");
		try {

			Long integral = 2L;

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) macaoCDFGoodsOwnerId, 0, false, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							502603484L, productBean, (int) macaoCDFGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setSku("C040644");
			orderItemVo.setProductRecordNo("C040644");
			orderItemVo.setFreight(BigDecimal.TEN);
			orderItemVo.setProductNum(1);
			orderItemVo.setProductPrice(new BigDecimal("1.25"));
			
			placeOrderReq.setCurrency("MOP");
			placeOrderReq.setIntegral(integral);
			placeOrderReq.setIntegralServiceType(2);
			
			BigDecimal exchangeRate = GodmchManageCallService
					.getEffectExchangeRate(502665591L);

			placeOrderReq.setIntegralDeductAmount(new BigDecimal(integral)
					.multiply(exchangeRate).setScale(2,
							BigDecimal.ROUND_HALF_DOWN));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setCrossBorderType(3);
			placeOrderReq.setIntegralExchangeRate(exchangeRate);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals("积分余额不足！", placeorderCall.getMsg(),
					"校验msg");

			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_195() {
		Logger.start(true, "中免大会员，带区域折扣，使用优惠码，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("60.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setFullReductionFreeFreight(true);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.15"));
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("9.00"));
			placeOrderReq.setGuideOrder(true);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponMainType(CouponMainTypeEnum.PROMOTION_CODE
					.getCode());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_196() {
		Logger.start(true, "中免大会员，使用多个优惠，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							false);

			CouponVo couponVo1 = SqTradingCallService.createSellerCouponVo(26080783L,
					cdfMembergoodsOwnerId, BigDecimal.TEN, BigDecimal.ONE);

			couponVo1.setCouponMainType(CouponMainTypeEnum.PROMOTION_CODE
					.getCode());

			CouponVo couponVo2 = SqTradingCallService.createSellerCouponVo(
					26080783L, cdfMembergoodsOwnerId, BigDecimal.TEN,
					BigDecimal.ONE);

			couponVo2.setCouponMainType(CouponMainTypeEnum.PROMOTION_CODE
					.getCode());
			
			placeOrderReq.getOrderGroups().get(0)
					.setSellerCoupons(Arrays.asList(couponVo1, couponVo2));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(true, placeorderCall.getMsg()
					.contains("同一类型商家优惠券/码数量不能大于1"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_197() {
		Logger.start(true, "中免大会员，优惠券和优惠码同时使用，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) cdfMembergoodsOwnerId,
							false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							26080783, productBean, (int) cdfMembergoodsOwnerId,
							false);

			CouponVo couponVo1 = SqTradingCallService.createSellerCouponVo(26080783L,
					cdfMembergoodsOwnerId, BigDecimal.TEN, BigDecimal.ONE);

			CouponVo couponVo2 = SqTradingCallService.createSellerCouponVo(
					26080783L, cdfMembergoodsOwnerId, BigDecimal.TEN,
					BigDecimal.ONE);

			couponVo2.setCouponMainType(CouponMainTypeEnum.PROMOTION_CODE
					.getCode());
			
			placeOrderReq.getOrderGroups().get(0)
					.setSellerCoupons(Arrays.asList(couponVo1, couponVo2));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(true, placeorderCall.getMsg()
					.contains("同一类型商家优惠券/码数量不能大于1"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_198() {
		Logger.start(true, "直销商下单一品多码组合商品,使用兑换码，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) multiCDFCodeGoodsOwnerId, false, true);
			
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.ZERO, 20238699, productBean,
					productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(3);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setSubProduct(true);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));
			couponVo.setCouponMainType(CouponMainTypeEnum.PROMOTION_CODE
					.getCode());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_199() {
		Logger.start(true, "中免大会员，使用资格券，扣除失败");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) shenqiRiskControlGoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							198411140, productBean, (int) shenqiRiskControlGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setSku("C052901");
			orderItemVo.setProductRecordNo("C052901");
			orderItemVo.setCdfVipCode("hlsfjsjglksjglejrl");

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(true, placeorderCall.getMsg()
					.contains("扣VIP购买资格券失败"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQCDFPlaceOrder_200() {
		Logger.start(true, "中免大会员，使用资格券，一个订单一个商品");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) shenqiRiskControlGoodsOwnerId,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							198411140, productBean, (int) shenqiRiskControlGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProductNum(1);
			orderItemVo.setSku("L064971");
			orderItemVo.setProductRecordNo("L064971");
			orderItemVo.setCdfVipCode(CDFMemberService.getUnuseEquityNo(198411140L, shenqiRiskControlGoodsOwnerId));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	public static void main(String[] args) {
	}
}
